package com.ymatou.paymentproxy.service;

import java.util.ArrayList;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.ymatou.paymentproxy.parameter.Detail;
import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;
/**
*检查是否可以退款接口Call
*FreeMaker Template自动生成代码
*/
public class CheckRefundableCall extends YmatouBaseCall{
	private static String opurl ="api/Refund/CheckRefundable";
	
	public CheckRefundableCall() {
		super(EnvSetup.getSystemUrl("paymentproxy"),opurl,"POST","JSON");
	}
	@Override
	public void addDefHeader() {
		client.addHeader("Accept","text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
	public ArrayList<Detail> getDetails() {
		ArrayList<Detail> details =new ArrayList<Detail>();
		try {
			details = (ArrayList<Detail>) new Gson().fromJson(this.getString("Details"), new TypeToken<ArrayList<Detail>>() {}.getType());
		} catch (Exception e) {
			e.printStackTrace();
		}
		return details;
	}
}